package com.carqueue.utils;

import java.util.Random;

public class InvitationCodeUtils {
    public static String randomInvitationCode() {
//        大写字母
        String upper = "ABCDEFGHICKLMNOPQRSTUVWXYZ";
//        小写字母
        String lower = "abcdefghijklmnopqrstuvwxyz";
//        数字
        String number = "0123456789";
//        拼接
        String allnums = upper + lower + number;
        StringBuffer InvitationCode = new StringBuffer();
        Random random = new Random();
//        随机索引选取字符放入
        for (int i = 0; i < 10; i++) {
            int index = random.nextInt(allnums.length());
            InvitationCode.append(allnums.charAt(index));
        }
        return InvitationCode.toString();
    }

/*    测试输出
    public static void main(String[] args) {
        String InvitationCode = randomInvitationCode();
        System.out.println(InvitationCode);
    }
 */
}
